<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="tKpYushouHList" sortName="createDate" sortOrder="desc" checkbox="true" fitColumns="false" title="收款单" actionUrl="tKpYushouHController.do?datagrid&ysType=预收" idField="id" fit="true" queryMode="group">

   <t:dgCol title="操作" field="opt" width="60"></t:dgCol>
   <t:dgCol title="收款流水号"  field="skid"     query="true"  queryMode="single"  width="100"></t:dgCol>

   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人名称"  field="createName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
     <t:dgCol title="更新人名称"  field="updateName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新人登录名称"  field="updateBy"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="更新日期"  field="updateDate"  formatter="yyyy-MM-dd"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="所属部门"  field="sysOrgCode"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="所属公司"  field="sysCompanyCode"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="流程状态"  field="bpmStatus"  hidden="true"  queryMode="single"  dictionary="bpm_status"  width="120"></t:dgCol>
   <t:dgCol title="客户编码"  field="cusCode"  query="true"  queryMode="single"  dictionary="t_kp_cus,cus_code,cus_name"  width="120"></t:dgCol>
   <t:dgCol title="客户名称"  field="cusName"  hidden="true"  queryMode="single"  width="60"></t:dgCol>
   <t:dgCol title="承建单位代码"  field="gdCode"  query="true"  queryMode="single"  dictionary="t_kp_gongdi,gd_code,gd_name"  width="240"></t:dgCol>
   <t:dgCol title="承建单位名称"  field="gdName"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="收款类型"  field="ysType"  queryMode="single"  dictionary="ys_type"  width="60"></t:dgCol>
   <t:dgCol title="代码"  field="gdDaima"  query="true"  queryMode="single"  width="60"></t:dgCol>
   <t:dgCol title="总金额"  field="skAmount"     queryMode="single"  width="80"></t:dgCol>
   <t:dgCol title="收款备注"  field="skRemark"  query="true"  queryMode="single"  width="60"></t:dgCol>
   <t:dgCol title="备用1"  field="by1"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="备用2"  field="by2"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="备用3"  field="by3"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="备用4"  field="by4"  hidden="true"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建人登录名称"  field="createBy"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="创建日期"  field="createDate"  formatter="yyyy-MM-dd"  query="true"  queryMode="group"  width="120"></t:dgCol>

   <t:dgFunOpt title="打印" operationCode="skprint" funname="doprint(id)"  urlclass="ace_button"       />

   <%--<t:dgDelOpt title="删除" url="tKpYushouHController.do?doDel&id={id}"  urlclass="ace_button" urlfont="fa-trash-o"/>--%>
   <t:dgToolBar title="收款" operationCode="skcreate" icon="icon-add" url="tKpYushouHController.do?goAdd&ysType=预收" funname="add" width="780" height="400"></t:dgToolBar>
   <%--<t:dgToolBar title="编辑" icon="icon-edit" url="tKpYushouHController.do?goUpdate" funname="update" width="100%" height="100%"></t:dgToolBar>--%>
   <%--<t:dgToolBar title="批量删除"  icon="icon-remove" url="tKpYushouHController.do?doBatchDel" funname="deleteALLSelect"></t:dgToolBar>--%>
   <t:dgToolBar title="查看" icon="icon-search" url="tKpYushouHController.do?goUpdate" funname="detail" width="780" height="400"></t:dgToolBar>
   <%--<t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>--%>
   <%--<t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>--%>
   <%--<t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>--%>
  </t:datagrid>
  </div>
 </div>
 <script src = "webpage/com/yserp/kp/tKpYushouHList.js"></script>		
 <script type="text/javascript">
     function doprint(id){
         var url = "tKpYushouHController.do?doPrint&id="+id;

         createdetailwindow("收款打印", url, 800, 400);

     }

     $(document).ready(function(){
         //绑定下拉框change事件，当下来框改变时调用 SelectChange()方法
         $("select[name='cusCode']").change(function() { SelectChange(); });
         $("select[name='gdCode']").change(function() { SelectgdChange(); });

     })

     function SelectgdChange() {
         var selectcusValue = $("select[name='cusCode']").val();
         var selectgdValue = $("select[name='gdCode']").val();
//加载工地
         var url = "tKpOrderController.do?setvalue&LcusCode="+selectcusValue+"&LgdCode="+selectgdValue;
         $.ajax({
             url:url,
             type:"GET",
             dataType:"JSON",
             async: false,
             success:function(data){
                 if(data.success){
                     $('#tKpOrderList').datagrid('reload',{});

                 }
             }
         });

     }
     function SelectChange() {

         //获取下拉框选中项的text属性值

         var selectText = $("select[name='cusCode']").find("option:selected").text();



         //获取下拉框选中项的value属性值

         var selectValue = $("select[name='cusCode']").val();

         console.log(selectValue);

         $("select[name='gdCode']").find("option").remove();


         //加载工地
         var url = "tKpGongdiController.do?getGongdiList&cusCode="+selectValue;
         $.ajax({
             url:url,
             type:"GET",
             dataType:"JSON",
             async: false,
             success:function(data){
                 if(data.success){
                     var gongdiList = data.attributes.gongdiList;
                     if(gongdiList.length > 0){
                         for(var i=0;i<gongdiList.length;i++){
                             var value = gongdiList[i].value;
                             var text = gongdiList[i].text;

                             $("select[name='gdCode']").append("<option value='"+value+"'>"+text+"</option>");
                         }
                     }

                 }
             }
         });

     }
//导入
function ImportXls() {
	openuploadwin('Excel导入', 'tKpYushouHController.do?upload', "tKpYushouHList");
}

//导出
function ExportXls() {
	JeecgExcelExport("tKpYushouHController.do?exportXls","tKpYushouHList");
}

//模板下载
function ExportXlsByT() {
	JeecgExcelExport("tKpYushouHController.do?exportXlsByT","tKpYushouHList");
}
 </script>